<template>
<!-- <iframe :src="pdfUrl" frameborder="0"></iframe>-->
  <VuePdf v-for="page in numOfPages" :key="page" :src="pdfUrl" />
</template>
<script setup>
import {useRoute} from "vue-router";
import {onMounted, ref,reactive} from "vue";
import api from '@/api/index.js'
import { VuePdf, createLoadingTask } from 'vue3-pdfjs/esm';
const pdfUrl=ref("")
const numOfPages = ref(0)
onMounted(()=>{
   api.getPdfPreview({id:route.query.id}).then(res=>{
      console.log(res.result)
      pdfUrl.value='http://localhost:3030/'+res.result.urlName
     const loadingTask = createLoadingTask(pdfUrl.value)
     loadingTask.promise.then((pdf) => {
       numOfPages.value = pdf.numPages
     })
   })
})
</script>

<style scoped lang="scss">

</style>